package org.mixed.script;

import org.mixed.script.runtime.MixScriptClassLoader;
import org.mixed.script.runtime.MixScriptContext;
import org.mixed.script.runtime.MixScriptRuntime;
import org.objectweb.asm.ClassWriter;

import javax.script.*;
import java.lang.reflect.InvocationTargetException;

public class MixScript extends CompiledScript {

    private final ClassWriter classWriter;
    private final String className;

    public MixScript(String name) {
        className = name;
        classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
    }

    public Object execute(MixScriptContext context) {
        MixScriptRuntime runtime = null;
        return null;
    }

    @Override
    public Object eval(ScriptContext context) throws ScriptException {
        Bindings bindings = context.getBindings(ScriptContext.ENGINE_SCOPE);

        MixScriptContext mixScriptContext = new MixScriptContext();
        return execute(mixScriptContext);
    }

    @Override
    public ScriptEngine getEngine() {
        return null;
    }
}
